﻿@using ContestMeter.Web.Site.Models
@model TeamsEditViewModel

@{
    ViewBag.Title = "Редактировать команду";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2 class="alert alert-info">Редактировать команду <b>"@Model.Name"</b></h2>


@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()

    if (TempData["Message"] != null && TempData["Message"].ToString() != "")
    {
        <div class="col-md-12 alert alert-success">@TempData["Message"]</div>
        <br />
    }

    <div class="form-horizontal">
        @Html.ValidationSummary(true)
        @Html.HiddenFor(model => model.TeamId)

        <div class="alert alert-warning">
            <div class="form-group">
                @Html.LabelFor(model => model.Name, "Название", new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.EditorFor(model => model.Name)
                    @Html.ValidationMessageFor(model => model.Name)
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.MaxTeamNumber, "Максимальное количество участников", new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.EditorFor(model => model.MaxTeamNumber)
                    @Html.ValidationMessageFor(model => model.MaxTeamNumber)
                </div>
            </div>

            <div class="form-group">
                <div class="col-md-offset-2 col-md-10">
                    <input type="submit" value="Сохранить" class="btn btn-default" />
                </div>
            </div>
        </div>

        <div class="form-group">
            <div class="col-md-12">
                @Html.Action("TeamParticipantsList", "Team", new { id = Model.TeamId })
            </div>
        </div>

        <div class="form-group">
            <div class="col-md-12">
                @Html.Action("TeamContestsList", "Team", new { id = Model.TeamId })
            </div>
        </div>
    </div>
}

<hr />
<div>
    @Html.ActionLink("Вернуться к списку команд", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
